package myNewProject.utils;

import java.lang.reflect.Constructor;

public class MyReflectUtil {
    public static <T> T getInstance(String className) {
        T instance = null;
        Class<?> cla = null;
        try {
            cla = Class.forName(className);
            Constructor<?> constructor = cla.getConstructor();
            instance = (T)constructor.newInstance();

        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        return instance;
    }
}
